
package com.cbwl.eoas.cms.model.sysconfig;

import javax.validation.constraints.NotNull;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;
import org.springframework.util.StringUtils;

import com.cbwl.eoas.common.base.CommonBean;
import com.cbwl.eoas.common.cache.redis.RedisCache;
import com.cbwl.eoas.common.cache.redis.RedisKeyPrefix;
import com.cbwl.eoas.common.util.SpringContextUtil;


/**
 * 
 * <p>[描述信息：说明类的基本功能]</p>
 *
 * @author 虞云波 - yuyunbo@3856.cc
 * @version 1.0 Created on 2017年10月20日 下午5:24:14
 */
public class SysOrganizationDTO extends CommonBean {

	

	

	
	//可以直接使用: @Length(max=50,message="用户名长度不能大于50")显示错误消息
	//columns START
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -6468393133894426160L;
	private java.lang.Long id;
	@NotBlank @Length(max=32)
	private java.lang.String orgCode;
	@NotBlank @Length(max=128)
	private java.lang.String name;
	@NotNull 
	private java.lang.Integer orgType;
	
	private java.lang.String parentCode;
	@NotNull 
	private String orgStatus;
	@NotBlank @Length(max=5)
	private Integer orgLevel;
	@Length(max=128)
	private java.lang.String leader;
	@Length(max=16)
	private java.lang.String leaderPhone;
	@Length(max=32)
	private java.lang.String provinceCode;
	@Length(max=32)
	private java.lang.String cityCode;
	@Length(max=32)
	private java.lang.String countyCode;
	@Length(max=512)
	private java.lang.String adresss;
	
	private java.lang.Long creater;
	
	private java.util.Date gmtCreate;
	
	private java.lang.Long modifier;
	
	private java.util.Date gmtModified;
	//columns END

	private String parentName;
	
	private String param;
	
	private String orgStatusName;
	
	
	public void setId(java.lang.Long value) {
		this.id = value;
	}
	
	public java.lang.Long getId() {
		return this.id;
	}
	
	public void setOrgCode(java.lang.String value) {
		this.orgCode = value;
	}
	
	public java.lang.String getOrgCode() {
		return this.orgCode;
	}
	
	
	
	public java.lang.String getName() {
		return name;
	}

	
	public void setName(java.lang.String name) {
		this.name = name;
	}

	public void setOrgType(java.lang.Integer value) {
		this.orgType = value;
	}
	
	public java.lang.Integer getOrgType() {
		return this.orgType;
	}
	
	
	public java.lang.String getParentCode() {
		return parentCode;
	}

	
	public void setParentCode(java.lang.String parentCode) {
		this.parentCode = parentCode;
	}

	
	
	public String getOrgStatus() {
		return orgStatus;
	}

	
	public void setOrgStatus(String orgStatus) {
		this.orgStatus = orgStatus;
		if (!StringUtils.isEmpty(orgStatus)) {
			RedisCache<String, String> redisCache = (RedisCache<String, String>) SpringContextUtil.getBean("redisCache");
			String redisValue =  redisCache.getStr(RedisKeyPrefix.DIC_PREFIX+orgStatus);
			if (!StringUtils.isEmpty(redisValue)) {
				this.orgStatusName = redisValue;
			}
		}
	}

	
	public Integer getOrgLevel() {
		return orgLevel;
	}

	
	public void setOrgLevel(Integer orgLevel) {
		this.orgLevel = orgLevel;
	}

	public void setLeader(java.lang.String value) {
		this.leader = value;
	}
	
	public java.lang.String getLeader() {
		return this.leader;
	}
	
	public void setLeaderPhone(java.lang.String value) {
		this.leaderPhone = value;
	}
	
	public java.lang.String getLeaderPhone() {
		return this.leaderPhone;
	}
	
	public void setProvinceCode(java.lang.String value) {
		this.provinceCode = value;
	}
	
	public java.lang.String getProvinceCode() {
		return this.provinceCode;
	}
	
	public void setCityCode(java.lang.String value) {
		this.cityCode = value;
	}
	
	public java.lang.String getCityCode() {
		return this.cityCode;
	}
	
	public void setCountyCode(java.lang.String value) {
		this.countyCode = value;
	}
	
	public java.lang.String getCountyCode() {
		return this.countyCode;
	}
	
	public void setAdresss(java.lang.String value) {
		this.adresss = value;
	}
	
	public java.lang.String getAdresss() {
		return this.adresss;
	}
	
	public void setCreater(java.lang.Long value) {
		this.creater = value;
	}
	
	public java.lang.Long getCreater() {
		return this.creater;
	}
	
	public void setGmtCreate(java.util.Date value) {
		this.gmtCreate = value;
	}
	
	public java.util.Date getGmtCreate() {
		return this.gmtCreate;
	}
	
	public void setModifier(java.lang.Long value) {
		this.modifier = value;
	}
	
	public java.lang.Long getModifier() {
		return this.modifier;
	}
	
	public void setGmtModified(java.util.Date value) {
		this.gmtModified = value;
	}
	
	public java.util.Date getGmtModified() {
		return this.gmtModified;
	}
	
	public String getParentName() {
		return parentName;
	}

	
	public void setParentName(String parentName) {
		this.parentName = parentName;
	}
	
	public String getParam() {
		return param;
	}

	
	public void setParam(String param) {
		this.param = param;
	}
	
	public String getOrgStatusName() {
		return orgStatusName;
	}

	
	public void setOrgStatusName(String orgStatusName) {
		this.orgStatusName = orgStatusName;
	}

	public String toString() {
		return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
			.append("Id",getId())
			.append("OrgCode",getOrgCode())
			.append("Name",getName())
			.append("OrgType",getOrgType())
			.append("ParentCode",getParentCode())
			.append("OrgStatus",getOrgStatus())
			.append("OrgLevel",getOrgLevel())
			.append("Leader",getLeader())
			.append("LeaderPhone",getLeaderPhone())
			.append("ProvinceCode",getProvinceCode())
			.append("CityCode",getCityCode())
			.append("CountyCode",getCountyCode())
			.append("Adresss",getAdresss())
			.append("Creater",getCreater())
			.append("GmtCreate",getGmtCreate())
			.append("Modifier",getModifier())
			.append("GmtModified",getGmtModified())
			.toString();
	}
	
	public int hashCode() {
		return new HashCodeBuilder()
			.append(getId())
			.toHashCode();
	}
	
	public boolean equals(Object obj) {
		if(obj instanceof SysOrganizationDTO == false){return false;}
		if(this == obj){return true;}
		SysOrganizationDTO other = (SysOrganizationDTO)obj;
		return new EqualsBuilder()
			.append(getId(),other.getId())
			.isEquals();
	}
}

